package edu.upc.epe.trabajodw;

import java.util.Calendar;

import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;

import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.roo.addon.entity.RooEntity;
import org.springframework.roo.addon.javabean.RooJavaBean;
//import org.springframework.roo.addon.tostring.RooToString;

@RooJavaBean
//@RooToString
@RooEntity
public class Residente {



	@NotNull
    @Size(max = 10)
    private String codigo;

    @NotNull
    @Size(max = 60)
    private String nombres;

    @NotNull
    @Size(max = 60)
    private String apellidos;

    @NotNull
    @Size(max = 60)
    private String nrodocumento;

    @NotNull
    @Size(max = 60)
    @Pattern(regexp = "^([0-9a-zA-Z]([-.\\w]*[0-9a-zA-Z])*@([0-9a-zA-Z][-\\w]*[0-9a-zA-Z]\\.)+[a-zA-Z]{2,9})$")
    private String email;

    @NotNull
    @Size(max = 20)
    private String clave;
    
    @NotNull
    @Temporal(TemporalType.TIMESTAMP)
    @DateTimeFormat(style = "S-")
    private Calendar fechanacimiento;

	/* (non-Javadoc)
	 * @see java.lang.Object#toString()
	 */
	@Override
	public String toString() {
		// TODO Auto-generated method stub
		return (nombres + ' ' + apellidos);
	}
    
    
    
}
